/**
 * @auth: sce
 * @date: 1/9/18
 * @desc: 根据路径创建文件目录
 *  createFolder('/tmp/text/mulu1/mulu2')，将不断递归创建目录
 **/
const fs = require('fs');
const path = require('path');

const createFolder = (dirname) => {
    //出口，如果需要创建的文件存在，则递归完成
    if (fs.existsSync(dirname)) {
        return true;
    } else {
        //递归调用上一级菜单
        if (createFolder(path.dirname(dirname))) {
            fs.mkdirSync(dirname);
            return true;
        }
    }

};
module.exports = createFolder;